using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace Cobalt75.GreyMatter
{
    [AttributeUsage(AttributeTargets.Field)]
    public abstract class GMColumnBaseAttribute : Attribute
    {
        internal bool pReadOnly;

        public bool ReadOnly
        {
            get
            {
                return pReadOnly;
            }
            set
            {
                pReadOnly = value;
            }
        }

        internal bool pKey = false;
        public bool Key
        {
            get
            {
                return pKey;
            }
            set
            {
                pKey = value;
            }
        }
        internal bool pIsPrimary = false;
        public bool IsPrimary
        {
            get
            {
                return pIsPrimary;
            }
            set
            {
                pIsPrimary = value;
            }
        }
        internal bool pUnique = false;
        public bool Unique
        {
            get
            {
                return pUnique;
            }
            set
            {
                pUnique = value;
            }
        }
        internal bool pAllowNull = false;
        public bool AllowNull
        {
            get
            {
                return pAllowNull;
            }
            set
            {
                pAllowNull = value;
            }
        }
        internal bool pPrecision = false;
        public bool Precision
        {
            get
            {
                return pPrecision;
            }
            set
            {
                pPrecision = value;
            }
        }
        internal GMColumnLength pLengthType = GMColumnLength.Undefined;
        public GMColumnLength LengthType
        {
            get
            {
                return pLengthType;
            }
            set
            {
                pLengthType = value;
            }
        }
        internal int pColumnLength = 0;
        public int ColumnLength
        {
            get
            {
                return pColumnLength;
            }
            set
            {
                pColumnLength = value;
            }
        }
        internal string pColumnPrefix = "";
        public string ColumnPrefix
        {
            get
            {
                return pColumnPrefix;
            }
            set
            {
                pColumnPrefix = value;
            }
        }

        //Set by Cache generator
        internal bool pIsDatabaseColumn = true;
        public bool IsDatabaseColumn
        {
            get
            {
                return pIsDatabaseColumn;
            }
        }
        internal GMColumnType pColumnType = GMColumnType.ValueType;
        public GMColumnType ColumnType
        {
            get
            {
                return pColumnType;
            }
        }

        internal string pColumnName;
        public string ColumnName
        {
            get
            {
                return pColumnName;
            }
        }

        internal string pDatabaseTypeId;
        public string DatabaseTypeId
        {
            get
            {
                return pDatabaseTypeId;
            }
        }
        internal string pDatabaseDefaultValue;
        public string DatabaseDefaultValue
        {
            get
            {
                return pDatabaseDefaultValue;
            }
        }
        public void SetDatabase(string typeId, string defaultValue)
        {
            pDatabaseTypeId = typeId;
            pDatabaseDefaultValue = defaultValue;
        }

        internal Type pClrType;
        public Type ClrType
        {
            get
            {
                return pClrType;
            }
        }
        
        internal Type pGMRelationType;
        public Type GMRelationType
        {
            get
            {
                return pGMRelationType;
            }
        }
        internal GMTableAttribute pGMRelationAttr;
        public GMTableAttribute GMRelationAttr
        {
            get
            {
                return pGMRelationAttr;
            }
        }
        internal Type pGMParentType;
        public Type GMParentType
        {
            get
            {
                return pGMParentType;
            }
        }
        /*
        internal Type _GMIndexType;
        public Type GMIndexType
        {
            get
            {
                return _GMIndexType;
            }
        }*/
        internal FieldInfo pClrField;
        public FieldInfo ClrField
        {
            get
            {
                return pClrField;
            }
        }
        internal GMTableAttribute pGMTableAttribute;
        public GMTableAttribute GMTableAttribute
        {
            get
            {
                return pGMTableAttribute;
            }
        }
    }
}
